package b1.mobile.blackberry.entity;

import org.json.me.JSONException;
import org.json.me.JSONObject;

import b1.mobile.blackberry.util.JSONUtil;

public class GenericEntity {

	JSONObject _object = null;
	JSONUtil _utility = null;
	
	public GenericEntity(JSONObject obj){
		this._object = obj;
		this._utility = new JSONUtil(this._object);
	}
	
	public GenericEntity(){
		this(new JSONObject());
	}
	
	public Object getProperty(String name){
		return this._object.opt(name);
	}
	
	public String getStringProperty(String name){
		String value = "";
		return this._object.optString(name, value);
	}
	
	public void setProperty(String name, Object value){
		try {
			this._object.put(name, value);
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}
}
